Ext.ns('info');


info.get_info = function(){
	Ext.Ajax.request({
		url:  'services/change_info.php',
		method: 'POST',
		params: {act : 'info'},
		success: function (result, request ) {
			var info = Ext.decode(result.responseText);
			$('#username').html(info.username);
			$('#email').html(info.email);
			$('#password').html(info.password);
		}
	});
}

info.change_pass = function(old_pass,new_pass){
	Ext.Ajax.request({
		url:  'services/change_info.php',
		method: 'POST',
		params: {act : 'password',
				old_password : old_pass,
				password : new_pass},
		success: function ( result, request ) {
			if(result.responseText == 1){
				alert("Change password  successfully!");
				window.location = "?act=info";
			}
			
		}

	});
}

info.change_email= function(old_email,new_email){
	Ext.Ajax.request({
		url:  'services/change_info.php',
		method: 'POST',
		params: {act : 'email',
				old_email : old_email,
				email : new_email},
		success: function ( result, request ) {
			if(result.responseText == 1){
				alert("Change email  successfully!");
				window.location = "?act=info";
			}
		}

	});
}